package bits;

import java.util.BitSet;

public class BitsTest {
	public static void main(String str[]) {
		byte a = -12;
		System.out.println(fromByte(a));
	}
	
	public static BitSet fromByte(byte b)
	{
	    BitSet bits = new BitSet(8);
	    for (int i = 0; i < 8; i++)
	    {
	        bits.set(i, (b & 1) == 1);
	        b >>= 1;
	    }
	    return bits;
	}
}
